# Contributor: lauren n. liberda <lauren@selfisekai.rocks>
# Maintainer: lauren n. liberda <lauren@selfisekai.rocks>
pkgname=dart-stage0
# upgrade checklist: https://md.sdomi.pl/Q-ECZTJ2Qqyp3ahfJuYSBw
pkgver=3.5.0_alpha278_p0
pkgrel=0
pkgdesc="Dart is a client-optimized language for fast apps on any platform (temporary bootstrap package)"
url="https://dart.dev/"
arch="aarch64 armv7 riscv64 x86_64"
license="BSD-3-Clause"
options="!check"

_canonver="${pkgver/_p/.}"
case "$pkgver" in
	*.*.*_alpha*)
		_canonver="${_canonver/_alpha/-}.dev"
		;;
	*.*.*_beta*)
		_canonver="${_canonver/_beta/-}.beta"
		;;
esac

source="
	dart-musl-stage0-x64-$_canonver.tar.gz.noauto::https://github.com/dart-musl/dart/releases/download/$_canonver/dartsdk-linux-x64-release.tar.gz
	dart-musl-stage0-arm-$_canonver.tar.gz.noauto::https://github.com/dart-musl/dart/releases/download/$_canonver/dartsdk-linux-arm-release.tar.gz
	dart-musl-stage0-arm64-$_canonver.tar.gz.noauto::https://github.com/dart-musl/dart/releases/download/$_canonver/dartsdk-linux-arm64-release.tar.gz
	dart-musl-stage0-riscv64-$_canonver.tar.gz.noauto::https://github.com/dart-musl/dart/releases/download/$_canonver/dartsdk-linux-riscv64-release.tar.gz
"
builddir="$srcdir/"

provides="dart-bootstrap=$pkgver-r$pkgrel"
provider_priority=42

case "$CARCH" in
	aarch64) _dart_arch="arm64" ;;
	armv7) _dart_arch="arm" ;;
	riscv64) _dart_arch="riscv64" ;;
	x86_64) _dart_arch="x64" ;;
esac

build() {
	:
}

package() {
	mkdir -p "$pkgdir"/usr/lib "$pkgdir"/usr/bin "$pkgdir"/usr/include
	(
		cd "$pkgdir"/usr/lib
		tar xf "$srcdir"/dart-musl-stage0-$_dart_arch-$_canonver.tar.gz.noauto
		mv dart-sdk dart
	)
	ln -s ../lib/dart/bin/dart "$pkgdir"/usr/bin/dart
	ln -s ../lib/dart/bin/dartaotruntime "$pkgdir"/usr/bin/dartaotruntime
	ln -s ../lib/dart/include "$pkgdir"/usr/include/dart
}

sha512sums="
bf695384c0cdd10890dded4b16086e658f380ce527c25f8bd0d80f492bad229c1b9764f8bc2d68593488c15e92a4d4cd23d7004984e0db4913ad56baa9dc8b5e  dart-musl-stage0-x64-3.5.0-278.0.dev.tar.gz.noauto
9c56048a7a9fc45d4a6dfc8743d23d42e64ddecaf7df7f0724eae69391072589bff9b9996c0943e282bf9d9a4c7b75cd2ae5e872bec69c469835fae1eee80c8a  dart-musl-stage0-arm-3.5.0-278.0.dev.tar.gz.noauto
6aea96fa4243c6e9b604b24f04a10a2273004cd5f495cff77e26275ec9b6edc972b812a0fe2ca910481bb766635d784ba55557234dc3871f33a1321345213477  dart-musl-stage0-arm64-3.5.0-278.0.dev.tar.gz.noauto
e15d0e31f83ce16c7e66eea41115e4e844d471dcd8ab1b2698a64a2950e71204324ecf2d3c7d69df847578e6302120673091e5f479dcc0621f84fb8109a18d3e  dart-musl-stage0-riscv64-3.5.0-278.0.dev.tar.gz.noauto
"
